#ifndef __MD5_CLASS__
#define __MD5_CLASS__

#include "MessageDigest.h"

class MD5: public MessageDigest {
private:
	uint32_t mDigest[4];	// 16-byte digest
	uint8_t mBuffer[64];	// 64-byte chunk
	uint32_t mBufferSizeLow, mBufferSizeHigh;
	void transform(const uint8_t *block);
	static const uint32_t *byte_to_int(uint32_t *buf, const uint8_t *src, uint32_t ilen);
	static void int_to_byte(uint8_t *dest, const uint32_t *src, uint32_t ilen);

public:
	MD5():MessageDigest(TYPE_MD5, 16){}
	void init();
	void update(const void *data, unsigned int size);
	void final();
	const unsigned char *getDigest(){return (unsigned char*)mDigest;}
};

#endif 